package cn.tedu.oa.expenses.controller;

import cn.tedu.oa.base.response.JsonResult;
import cn.tedu.oa.expenses.pojo.dto.ExpensesQuery;
import cn.tedu.oa.expenses.pojo.dto.ExpensesSaveParam;
import cn.tedu.oa.expenses.pojo.vo.ExpensesVO;
import cn.tedu.oa.expenses.service.ExpensesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/oa1/expenses")
public class ExpensesController {
    @Autowired
    ExpensesService expensesService;
    @GetMapping("/select")
    public JsonResult select(ExpensesQuery expensesQuery){
        log.debug("查询费用报销");
        List<ExpensesVO> list = expensesService.select(expensesQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("save")
    public JsonResult save(ExpensesSaveParam expensesSaveParam){
        log.debug("保存费用报销");
        expensesService.save(expensesSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{id}")
    public JsonResult delete(@PathVariable Integer id){
        log.debug("删除费用报销");
        expensesService.delete(id);
        return JsonResult.ok();
    }


}
